<?php $altura_contenido = 0; ?>
<?php header("Content-type: text/html; charset=utf-8");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta property="og:title" content="Epicrisis - Historia Cl&#xed;nica Electr&#xf3;nica" />
        <meta property="og:type" content="website" />
        <meta property="og:url" content="http://www.facebook.com/epicrisis" />
        <meta property="og:image" content="http://www.epicrisisweb.com/images/iso-footer.png" />
        <meta property="og:site_name" content="Epicrisis" />
        <meta property="fb:admins" content="1038596663" />
	    <?php echo $this->Html->charset(); ?>
        <meta http-equiv="X-UA-Compatible" content="IE=8" />
        <title>
		<?php __('Epicrisis'); ?>
		<?php //echo $title_for_layout; ?>
        </title>
	    <?php
		echo $this->Html->meta('icon');
		echo $html->meta('icon','/images/favicon.ico', array('type' =>'icon'));		
		echo $this->Html->css('reset');
		echo $this->Html->css('epicrisis2');
		$custom_css = $this->Session->read('Client.custom_css');
		if(isset($custom_css)){ 
			echo $this->Html->css($custom_css); 
		} else {
			echo $this->Html->css('epicrisis_color_default');		
		}
        echo $this->Html->css('calendar');
        echo $this->Html->css('tablesorter');
        echo $this->Html->css('jquery.dialogr');        
        echo $this->Html->css('start/jquery-ui-1.8.18.custom');
        echo $this->Html->css('chosen');
        echo $this->Html->css('jquery.lightbox-0.5');
        // echo $this->Html->css('/js/jquery-autocomplete/jquery.autocomplete');
        echo $this->Html->css('lightview/lightview');

        
        echo $javascript->link('prototype-1.7');
        echo $javascript->link('scriptaculous');
        echo $javascript->link('jquery.tools.min.js'); // Incluye jQuery 1.6.4, Tabs, Tooltip, Scrollable, Overlay
        /* echo $javascript->link('jquery-ui-1.8.18.custom.min'); */
        echo $javascript->link('jquery-ui-1.10.2.js');
        
        echo $javascript->link('ui.dialogr');       
        echo $javascript->link('tiny_mce/jquery.tinymce');
        echo $javascript->link('chosen.jquery.min');
        echo $javascript->link('jquery.tipsy');
        echo $javascript->link('jquery.tablesorter.min'); 
        echo $javascript->link('jquery.lightbox-0.5.pack'); 
        echo $javascript->link('epicrisiscore');
        //echo $javascript->link('jquery-autocomplete/jquery.autocomplete');
        echo $javascript->link('jquery.jeditable.js');
        echo $javascript->link('jquery.validate'); 
        echo $javascript->link('lightview/lightview');
        echo $javascript->link('history/html4+html5/jquery.history');


    	?>


        <script type="text/javascript" src="/js/validate/messages_es.js"></script>
    </head>
    <body>
        <script type="text/javascript">$j = jQuery.noConflict();</script>
        <div id="fb-root"></div>
        <script>(function (d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id))
                    return;
                js = d.createElement(s);
                js.id = id;
                js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=98759276096";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));</script>

        <div id="cargando" style="position: fixed; display:none;"><p><?php __('Cargando'); ?>&nbsp;<img src="/images/cargando.gif"></p></div>

        <div id="contenedor_encabezado">

            <div id="encabezado_gral2">

                <div id="encabezado2"> 

                    <div id="logo">
        				<?php 
        					$logo = $this->Session->read('Client.logo');
        					if(!empty($logo)){ $logo = $this->webroot.'uploads/'.$logo;	} else { $logo = '/images/logo_traditum.png'; }
        				?>
                        <a href="/dashboards"><img src="<?php echo $logo;?>" style='max-height:40px;'></a>
                    </div>
                    <div id='buscador-pacientes'>
                        <style>
                            .ui-autocomplete {z-index:10000; min-width:500px !important;}
                        </style>
                        <input type='text' id='personquicksearch' placeholder='Buscador de Pacientes....'>
                        <input type='hidden' id='patient_id' value=''>

                        <script>
                            jQuery(document).ready(function() {
                                // Autocomplete
                                jQuery( "#personquicksearch" ).autocomplete({
                                    source: "/ajax/obtiene_pacientes/",
                                    minLength: 2,
                                    select: function( event, ui ) {
                                        window.location.assign("/people/view/"+ui.item.id)
                                        //jQuery( "#patient_id" ).val(ui.item.id);
                                    }
                                });
                            });                
                        </script>
                    </div>

                    <div id="accesos">
                        <ul>
                            <li>
                                <a href="/dashboards">
                                    <img src="/images/btn1-off.png" title="<?php echo __('Inicio',true) ?>" alt="<?php echo __('Inicio',true) ?>">
                                </a>
                            </li>

                            <li style="margin-top: 11px;margin-left: 5%;">
                                <span class="btn btn-inverse disabled" style="margin-top: -8px;" id="nombre_rol_actual"><?php echo __($session->read('VistaActual'),true) ?></span>
                            </li>

                            <li style="margin-left: 10px;">
                                <div id="nombre_cliente">
							        <?php echo $this->Html->image("/images/ico-config2.png", array(
                                                                    'alt' => __('Configuración',true),
                                                                    'title' => __('Configuración',true), 
                                                                    'align' => 'absbottom', 
                                                                    'style' => 'cursor: pointer;'));
                                    ?>

                                    <div id="opciones_cliente" style="display:none;">
                                        <ul>
                                            <li style="border-top: none; cursor:default;">
                                                <div style="margin-top: 4px;">
                                                    <?php echo $ajax->link("<i class='icon-user icon-white'></i>".$session->read('Auth.User.name')." ".$session->read('Auth.User.lastname'),'/clients_users/edit/'.$session->read('Auth.User.id').'/'.$session->read('ClientesUsuarioLogueado.id'), array( 'update' => 'panel_derecho', 'indicator' => 'cargando', 'class' => 'btn btn-warning', 'style' => 'color: white;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;width: 153px;','escape'=> false));?>
                                                </div>
                                            </li>

                                            <li>
                                                <?php echo $ajax->link(__('Recomendar Epicrisis', true),'/clients/recomendar', array( 
                                                                                                            'update' => 'panel_derecho', 
                                                                                                            'indicator' => 'cargando', 
                                                                                                            'escape'=> false));
                                                ?>
                                            </li>
                                            
                                            <?php
                                        	    // Si el Usuario Logueado tiene más de 1 Rol
                                        	    if(count($this->Session->read('ListadoRolesUsuarioLogueado')) > 1){
                                                    echo '<li><strong>Cambiar de Rol</strong>';
                                        			foreach($this->Session->read('ListadoRolesUsuarioLogueado') AS $id_rol => $registro){
                                        				echo "<div style='margin-top: 7px;margin-bottom: 7px;margin-left: 5px;'><a href='#' onclick='SetRolActual($id_rol)'>".__($registro, true)."</a></div>";
                                        			}
                                        			echo '</li>';
                                        		}
                                            ?>    
                                       		
                                        </ul>
                                    </div>
                                </div>

                            </li>
                            
                            <li>
                                <a href="javascript:CerrarSesion()">
                                    <img src="/images/btn7-off.png" title="<?php echo __('Cerrar Sesión',true) ?>" alt="<?php echo __('Cerrar Sesión',true) ?>">
                                </a>
                            </li>

                        </ul>
                    </div>
                </div>
            </div>
        </div>	<!-- end div contenedor_encabezado -->
        
        <?php
	       if($this->requestAction('/users/mostrarmsgupdate') ){
		      $mensaje_update = $this->Session->read('UltimoUpdateUsuario_'.$this ->Session->read('Auth.User.id'));
		      echo '<div id="msg_update"><h1>'.__('Novedades', true).'</h1><p>'.nl2br($mensaje_update['Update']['name']).'</p><p><a href="javascript:ConfirmarUpdates()" class="link_destacado">'.__('Aceptar', true).'</a></p></div>';
	       }
        ?>

        <div id="contenedor">
            <div id="panel_izquierdo">&nbsp;</div>
            <div id="panel_derecho">
    			<?php echo $this->Session->flash(); ?> 
                <?php echo $content_for_layout; ?>
            </div>
        </div>
        
        <div id="ventana_modal"></div>
        <div id="dialog-message"></div>


        <script type="text/javascript">
        <!--
            //CargarListadoRapidoPacientes('personquicksearch');
        //-->
        </script>

        <div id="footer">
	       <?php echo $this->element('analytics'); ?>
        </div>

    </body>
</html>